package main

import (
	"encoding/json"
	"fmt"
)

type Person struct {
	Name string `json:"name"`
	Age  int    `json:"age"`
}

// 了解反射
func main() {
	str := `{"name":"李四" ,"age":18}`
	var p Person
	json.Unmarshal([]byte(str), &p)

	// var x int
	// json.Unmarshal([]byte(str), x)

	fmt.Println(p.Name)
	fmt.Println(p.Age)
}
